import React, { PureComponent } from 'react';
import { Breadcrumb } from 'antd';

export default class Breadcrumbs extends PureComponent {
  state = {};

  markBreItems = signDetailProductDto => {
    const { projectName } = this.props;
    const {
      businessType,
      businessTypeName,
      freeType,
      freeTypeName,
      groupId,
      groupName,
      proType,
      proTypeName,
      productCode,
      productName,
    } = signDetailProductDto;
    const breItems = [];
    breItems.push(
      {
        value: projectName,
        code: '0',
        key: 'projectName',
      },
      {
        value: '编制业态签约计划',
        code: '0',
        key: 'xxxxx',
      },
      // {
      //   value: groupName,
      //   code: groupId,
      //   key: 'groupId',
      // },
      // {
      //   value: productName,
      //   code: productCode,
      //   key: 'productCode',
      //   childe: [
      //     {
      //       value: businessTypeName,
      //       code: businessType,
      //       index: 1,
      //       key: 'businessType',
      //     },
      //     {
      //       value: freeTypeName,
      //       code: freeType,
      //       index: 2,
      //       key: 'freeType',
      //     },
      //     {
      //       value: proTypeName,
      //       code: proType,
      //       index: 3,
      //       key: 'proType',
      //     },
      //   ],
      // },
    );
    return breItems;
  };

  render() {
    const { signDetailProductDto } = this.props;
    const breItems = this.markBreItems(signDetailProductDto);
    return (
      <Breadcrumb>
        {breItems.map(ele => (
          <Breadcrumb.Item key={ele.key}>
            {ele.value}
            {ele.childe
              ? ele.childe.map(v => (
                  <Breadcrumb.Item key={v.index}>{` - ${v.value}`}</Breadcrumb.Item>
                ))
              : null}
          </Breadcrumb.Item>
        ))}
      </Breadcrumb>
    );
  }
}
// (
//
// )
